function prepareGallery() {

  var gallery = document.getElementById("imagegallery");
  var links = gallery.getElementsByTagName("a");

  for (var i = 0; i < links.length; i++) {
    links[i].onclick = function() {
      showPic(this);
      return false;
    }
  }
}

function showPic(source) {

  var image = document.getElementById("placeholder");
  image.setAttribute("src", source.getAttribute("href"));
}

window.onload = prepareGallery;
